/**
* @Description: 台账管理
* @author 
*/
<template>
	<view class="ledger-management-main">
		<!-- 头部 -->
		<nav-bar class="header" back title="台账管理" @goBack="exitBtn">
		</nav-bar>
		<!-- 图标选择 -->
		<view class="ledger-management-wrap">
			<view class="work-application" v-for="(item,index) in moduleList" :key="index">
				<view class="work-application-wrap">
					<view class="work-application-title"> {{item.menuName}} </view>
					<view class="work-application-container">
						<view class="work-application-item" v-for="(val, index) in item.menuChild" :key="index"
							@click="chooseMenu(val,index)">
							<image :src="require(`../../static/img/${val.iconUrl}`)" mode=""></image>
							<text>{{ val.menuName }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import baseConfig from "../../common/config";
	import navBar from "../../components/common/nav-bar.vue";
	import {
		getMenus
	} from "../../api/ydtzApi.js"
	import {
		mapGetters
	} from 'vuex'
	export default {
		data() {
			return {
				moduleList:[],
				siteRoomList: [{
					name: "站点机房",
					imgUrl: 'ydtz-site.png',
					url: '/pages/standingBook/siteRoom/siteRoom'
				}, ],
				resourceCommunication: [{
						name: "传输设备",
						img: "ydtz-transmit.png",
						url: `/pages/standingBook/transmissionEquipment/transmissionEquipment?deviceFlag=1`
					},
					{
						name: "通信电源",
						img: "ydtz-power.png",
						url: `/pages/standingBook/transmissionEquipment/transmissionEquipment?deviceFlag=2`
					},
					{
						name: "通信路由器",
						img: "ydtz-router.png",
						url: `/pages/standingBook/transmissionEquipment/transmissionEquipment?deviceFlag=3`
					},
					{
						name: "通信光缆",
						img: "ydtz-optical.png",
						url: '/pages/standingBook/communicationOpticalCable/communicationOpticalCable'
					},
					{
						name: "光路管理",
						img: "ydtz-opticalPath.png",
						url: '/pages/standingBook/opticalPathManagement/opticalPathManagement'
					},
					// {
					// 		name: "业务管理",
					// 		img: "../../static/img/ydtz-bussinessMangement.png",
					// 		url: '/pages/standingBook/businessManagement/businessManagement'
					// },	
				]
			}
		},
		components: {
			navBar,
		},
		onLoad() {
			this.getMenus()
		},
		computed: {
			...mapGetters(['userData'])
		},
		methods: {
			// 菜单列表
			getMenus() {
				this.moduleList = this.userData
			},
			chooseMenu(item) {
				switch (item.iconUrl) {
					case "ydtz-site.png": {
						uni.navigateTo({
							url: '/pages/standingBook/siteRoom/siteRoom'
						})
						break
					}
					case "ydtz-transmit.png": {
						uni.navigateTo({
							url: `/pages/standingBook/transmissionEquipment/transmissionEquipment?deviceFlag=1`
						})
						break
					}
					case "ydtz-power.png": {
						uni.navigateTo({
							url: `/pages/standingBook/transmissionEquipment/transmissionEquipment?deviceFlag=2`
						})
						break
					}
					case "ydtz-router.png": {
						uni.navigateTo({
							url: `/pages/standingBook/transmissionEquipment/transmissionEquipment?deviceFlag=3`
						})
						break
					}
					case "ydtz-optical.png": {
						uni.navigateTo({
							url: `/pages/standingBook/communicationOpticalCable/communicationOpticalCable`
						})
						break
					}
					case "ydtz-opticalPath.png": {
						uni.navigateTo({
							url: `/pages/standingBook/opticalPathManagement/opticalPathManagement`
						})
						break
					}
				}
			
			},
			exitBtn() {
				baseConfig.actions.exitIgw();
			},
			enterWorkbench(item) {
				uni.navigateTo({
					url: item.url
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	page {
		background-color: #f2f6fa;
		;
	}

	.header {
		position: sticky;
		top: 0;
		z-index: 999;
	}

	.work-application {
		width: 94%;
		background: #ffffff;
		border: px2vh(2) solid #ffffff;
		border-radius: px2vh(20);
		margin: 0 auto;
		margin-top: px2vh(30);
		padding: px2vh(40) px2vw(40);
		box-sizing: border-box;
	}

	.work-application-title {
		font-size: px2vh(40);
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		text-align: left;
		color: #666666;
		line-height: px2vh(54);
	}

	.work-application-container {
		display: flex;
		flex-wrap: wrap;
	}

	.work-application-item {
		// width: px2vw(200);
		width: 25%;
		display: flex;
		flex-direction: column;
		align-items: center;
		// margin: 0 px2vw(31);
		margin-top: px2vh(39);
		box-sizing: border-box;

		image {
			width: px2vw(146);
			height: px2vw(146);
		}

		text {
			opacity: 0.7;
			font-size: px2vh(36);
			font-family: Microsoft YaHei, Microsoft YaHei-Regular;
			font-weight: 400;
			text-align: center;
			color: #333333;
			line-height: px2vh(46);
		}
	}
</style>